package pack.projectiles;

import com.jme.scene.Controller;

@SuppressWarnings("serial")
public class ProjectileMover extends Controller 
{
    private Projectile projectile = null;

    public ProjectileMover(final Projectile projectile) {
        this.projectile = projectile;
    }

    public final void update(final float time) {
        projectile.setAge(projectile.getAge() - time);
        if (projectile.getAge() < 0) {
            projectile.die();
            return;
        }
        projectile.getNode().getLocalTranslation().addLocal(
        		projectile.getDirection().mult(time * projectile.getSpeed()));
    }
}
